#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional, TypeVar, Generic, List, Union

from pydantic import BaseModel
from pydantic.generics import GenericModel

from app.db.base_class import Base

PT = TypeVar("PT", bound=Union[BaseModel, Base])

class PageParam(BaseModel):
    pageNum: int
    pageSize: int


class PageResult(GenericModel, Generic[PT]):
    pageNum: int
    pageSize: int
    total: int
    items: List[PT]

    class Config:
        arbitrary_types_allowed = True
